/**
 * AboutDialog.java
 * Author: Bonifacio Costiniano
 * Description:
 * 	Dialog class for getting threshold value.
 *
 * 	Code based of same code provided by Prof. Grewe.
 */


import java.awt.*;
import java.awt.event.*;

public class ThresholdDialog extends Dialog
	implements ActionListener {

	private TextField textField = new TextField("", 20);
	private Button OK = new Button("OK");
	private Button no = new Button("No");
	private IPFrame frame;

	public void actionPerformed(ActionEvent evt) {
		p.print("Threshold: " + textField.getText());
		frame.setThresholdValue(textField.getText());
		this.dispose();
	}
  
	public ThresholdDialog(IPFrame parent, boolean modal)
	{
		super(parent, modal);
		frame = parent;

		this.add(BorderLayout.CENTER, new Label("Input threshold value:"));
		Panel p = new Panel();
		p.setLayout(new FlowLayout());

		p.add(textField);
		OK.addActionListener(this);
		p.add(OK);

		this.add(BorderLayout.SOUTH, p);
		this.setSize(300,100);
		this.setLocation(100, 200);
		this.pack();
	}
}
